from django.db import models
from django.contrib.auth.models import User
# Create your models here.


class Classes(models.Model):
    name = models.CharField(max_length=30, verbose_name='班级名')
    slogan = models.TextField(null=True, blank=True,verbose_name='口号')
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')
    is_delete = models.BooleanField(default=False, verbose_name='逻辑删除')

    member = models.ManyToManyField(User)

    class Meta:
        db_table = 'classes'
        verbose_name = '班级'
        verbose_name_plural = verbose_name

    def delete(self, using=None, request=None):
        self.is_delete = True
        self.save()
